<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title> 我的注册信息 - LooPo-乐铺 </title>
<?php include VIEWS.'header.html'?>

<?php include VIEWS.'ajax.js.html'?>

<script type="text/javascript">
<!--
var aa = ajaxStart();
var timer = null;

function user_edit() {
    $('submit').disabled = true;
    $('submit1').disabled = true;
    var f = $('updateform');
   
    $('updatemsg').hide(); $('loading').show();

    try {
        aa.call('/myRegInfo.php', 'ajaxuserRegInfo', useredit_result, $('updateform').serialize());
        return false;
    } catch (e) {
        return true;
    }
}

function useredit_result(result) {
    var i;
    var d = $('updatemsg');
    try {
        var stat = result.result[0].data;
        if (stat==1)    i = '您的注册资料已更新';
        if (stat==2)    i = '<font color=FFFF66>更新失败</font>，请检查您填写的资料完整性后再提交';
        if (stat&8)     i = '更新失败，请检查您的邮箱地址';
        if (stat&4)     i = '更新失败，请检查您的密码长度';
        if (stat&16)    i = '输入的密码与确认密码不符';
    } catch(e) {
        var err = 1;
        i = '服务器错误，请稍候再试';
    }

    if (stat&8 || stat&4 || stat&16 || err) {
        d.style.backgroundColor= '#FF6600';
        d.style.color = '#FFF';
    } else {
        d.style.backgroundColor= '#DDF63E';
        d.style.color = '#000';
    }

    $('submit').disabled = false;
    $('submit1').disabled = false;
    d.innerHTML = '&nbsp;&nbsp;&nbsp;' + i + '……';

    $('loading').hide(); $('updatemsg').show();
    new Effect.Round('div', 'updatemsg');
    
    location.href="#top";
    if (timer) window.clearTimeout(timer);
    timer = window.setTimeout( "$('updatemsg').style.display='none';", 10000);

    if (stat&4)     $('password').select();
    if (stat&8)     $('email').select();
    if (stat&16)    $('password_r').select();
}
//-->
</script>

</head>

<body>

<?php include VIEWS.'topbar.html'?>

<div id="content">

    <?php include VIEWS.'leftnav.html'?>

    <div id="right">

    <h1>我的资料</h1>

    <div id="loading" style="display:none;padding-left:1em"><img src="/images/icon_indicator.gif" width="220" height="19" alt=""  /></div>
    <div class="updatemsg" id="updatemsg" style="font-weight:bold;background-color:#DDF63E;font-size:12px;width:90%;display:none;">&nbsp;</div>
    <?php if($code['userRegInfo'] == 1):?><div class="goodbox roundNormal" style="width:90%">&nbsp;&nbsp;您的注册资料已经更新成功了</div><?php endif?>
    <?php if($code['userRegInfo'] & 8):?><div class="errbox roundNormal" style="width:90%">&nbsp;&nbsp;您的email地址不正确哦</div><?php endif?>
    <?php if($code['userRegInfo'] & 4):?><div class="errbox roundNormal" style="width:90%">&nbsp;&nbsp;密码的长度要为 3-16 位哦</div><?php endif?>
    <?php if($code['userRegInfo'] == 16):?><div class="errbox roundNormal" style="width:90%">&nbsp;&nbsp;您的确认密码与密码不相符，请检查</div><?php endif?>

<form action="" method="post" id="updateform" onsubmit="javascript:user_edit();return false;">
<h3 style="margin-bottom:5px"><img src="/images/icon_arrow_down.gif" />注册资料</h3><hr size="1" />
<table cellpadding="3" width="98%" cellspacing="4" border="0">
<?php if(strlen($data['username'])<32):?>
<tr><td width="15%" class="px12"<b>会员名</b></td><td class="px12"><b><?php echo $data['username']?></b></td></tr>
<?php endif?>
<tr><td class="px12"><b>昵称</b></td><td class="px12"><input class="px12 input1" tabindex="1" maxlength="100" size="26" type="text" id="nickname" name="nickname" value="<?php echo $data['nickname']?>"></td></tr>
<tr><td class="px12"><b>注册邮箱</b></td><td class="px12"><input class="px12 input1" tabindex="1" maxlength="100" size="26" type="text" id="email" name="email" value="<?php echo $data['email']?>" disabled="disabled"></td></tr>
<tr><td class="px12"><b>真实姓名</b></td><td class="px12"><input class="px12 input1" tabindex="1" maxlength="20" size="10" type="text" name="truename" value="<?php echo $data['truename']?>"></td></tr>
<tr><td class="px12"><b>联系电话</b></td><td class="px12"><input class="px12 input1" tabindex="1" maxlength="20" size="16" type="text" name="tel" value="<?php echo $data['tel']?>"></td></tr>
<tr><td class="px12"><b>默认地址</b></td><td class="px12"><input class="px12 input2" tabindex="1" maxlength="200" size="40" type="text" name="address" value="<?php echo $data['address']?>"></td></tr>
<tr><td class="px12"><b>地址邮编</b></td><td class="px12"><input class="px12 input0" tabindex="1" maxlength="10" size="10" type="text" name="zipcode" value="<?php echo $data['zipcode']?>"></td></tr>
<tr style="display:none"><td class="px12"><b>级别</b></td><td class="px12"><?php echo $data['rank']?></td></tr>
<tr style="display:none"><td class="px12"><b>积分</b></td><td class="px12"><?php echo $data['score']?></td></tr>
<tr style="display:none"><td colspan="2"><br /><b>您已经加入乐铺 <?php echo ceil((time()-$data['created'])/(3600*24))?> 天了</b></td></tr>
</table>
<br />
<input tabindex="2" id="submit" type="submit" value="更新我的注册资料" class="bluebtn" />

<br /><br /><br />

<h3 style="margin-bottom:5px"><img src="/images/icon_arrow_down.gif" />密码更新</h3><hr size="1" />
<table cellpadding="3" width="98%" cellspacing="4" border="0">
<tr><td class="px12"><b>新密码</b></td><td class="px12"><input class="px12 input1" tabindex="1" maxlength="16" type="password" id="password" name="password" value=""> &nbsp; <span class="px12">(如果您不想更改密码，请保持这里为空)</font></td></tr>
<tr><td class="px12"><b>确认密码</b></td><td class="px12"><input class="px12 input1" tabindex="1" maxlength="16" type="password" id="password_r" name="password_r" value=""></td></tr>
</table>
<br />
<input tabindex="2" id="submit1" type="submit" value="更新我的密码" class="bluebtn" />
</form>

    </div>
</div>

<?php include VIEWS.'copyright.html'?>

</body>
</html>
